package zjhr.com.controller;

import java.lang.reflect.Method;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import zjhr.com.pojo.EasyUIPageQuery;
import zjhr.com.pojo.ZjUser;
import zjhr.com.service.UserService;
import zjhr.com.utils.JsonUtils;
import zjhr.com.utils.TaotaoResult;

@Controller
public class UserController {
	@Autowired
	private UserService userService;
	//添加用户
	@RequestMapping(value="/addUserInfo.action",method=RequestMethod.POST)
	public String addUserInfo(ZjUser user){
		TaotaoResult result = userService.save(user);
		return "redirect:/base/yewu.action";
	}
	//分页
	@RequestMapping("/UserPageQuery.action")
	@ResponseBody
	public String pageQuery(Integer page,Integer rows){
		
		EasyUIPageQuery pageQuery = userService.findListByPage(page, rows);
		
		return JsonUtils.objectToJson(pageQuery);
	}
	
	//人员状态-离职
	@RequestMapping("/checkUserType.action")
	public String  checkUserType(String ids){
		userService.checkUserType(ids);
		
		return "redirect:/base/yewu.action";
		
	}
}
